export HASTHI_HOME=`pwd`
export MNG_MAX_HEAP="1024m"
cd $HASTHI_HOME

#RESOURCE_PER_MANAGER="200 300 400 500 600 700 800 900 1000"

#RESOURCE_COUNTS="10000 20000 30000 40000" 
#50000 60000 70000"
#MNG_COUNT="20 50 200 500 1000"
#MNG_COUNT="100"
#RESOURCE_PER_MANAGER="50 10"
#MNG_COUNT_PER_HOST="10"
HOST_COUNT="10"
#HOST_COUNT="10"
#MNG_COUNT=$(($MNG_COUNT_PER_HOST*$HOST_COUNT))

PAIRS="50,80000"
#PAIRS="20,10000 20,40000 20,60000"

for p in ${PAIRS}; do
        md=`echo $p|cut -f1 -d','`
        RESOURCE_COUNT=`echo $p|cut -f2 -d','`

	$HASTHI_HOME/bootstrap.sh reset
	sleep 1s
		
	export LOG_DIR=/u/hperera/logs/hasthi_${RESOURCE_COUNT}X${md}_`date +%m_%d_%H_%M`
	echo $LOG_DIR
	mkdir $LOG_DIR
	cmd1="srun -N 1 ./testMngeNode.sh $HASTHI_HOME/hasthi.properties $HASTHI_HOME $LOG_DIR"
	cmd2="srun -N $HOST_COUNT ./simMng.sh $(($md/$HOST_COUNT)) $(($RESOURCE_COUNT/$md))"
	echo $cmd1 $cmd2
	$cmd1 &
	sleep 40s
	$cmd2
	#Following wait for all child processes to complete 
	wait
	mv hasthi*.log $LOG_DIR
	echo $RESOURCE_COUNT"X"$md "Done"
done 
